<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <h:body>

        <ui:composition template="/resources/template/template.xhtml">

            <ui:define name="content">

                <p:panel >


                    <p:panel  id="panelQueue" header="Queue" >
                        <h:form>
                            <h:panelGrid columns="3" >
                                <h:outputLabel value="Date" id="calSessionDate" ></h:outputLabel>
                                <p:calendar value="#{practiceBookingController.sessionDate}" pattern="dd MMMM yyyy" >
                                </p:calendar>
                                <h:outputLabel value="" ></h:outputLabel>
                                <p:commandButton   value="Process" ajax="false" style="float: right;" 
                                                  action="#{practiceBookingController.listPatientEncounters()}" 
                                                   onclick="onSubmitButton();" >                        
                                </p:commandButton>
                            </h:panelGrid>
                        </h:form>

                        <h:form>
                            <p:dataTable id="bSessionCompleted" 
                                         value="#{practiceBookingController.encounters}" var='bsc'
                                         selectionMode="single" rowKey="#{bsc.id}"
                                         selection="#{practiceBookingController.selectedBillSession}">
                                <p:column headerText="No">#{bsc.billSession.serialNo}</p:column>
                                <p:column headerText="Patient Name">#{bsc.billSession.bill.patient.person.nameWithTitle}</p:column>
                                <p:column headerText="View/Edit">
                                    <p:commandButton value="Visit" action="#{practiceBookingController.opdVisitFromQueue()}" ajax="false" onclick="onSubmitButton();" >
                                        <f:setPropertyActionListener value="#{bsc.billSession}" target="#{practiceBookingController.billSession}" ></f:setPropertyActionListener>
                                    </p:commandButton>
                                </p:column>
                                <p:column headerText="Details">
                                    <h:outputText value="#{bsc.comments}" ></h:outputText>
                                </p:column>
                            </p:dataTable>  



                        </h:form>
                    </p:panel>




                </p:panel>

            </ui:define>



        </ui:composition>

    </h:body>
</html>
